import { create } from 'zustand';

interface VideoPlayerState {
  bears: number;
  increase: (by: number) => void;
  //   视频播放地址
  VideoPlayerSRc: string;
  //   设置视频播放地址
  setVideoPlayerSrc: (src: string) => void;
  //   视频目录的高亮
  VideoPlayerIndex: number;
  //   设置视频目录的高亮
  setVideoPlayerIndex: (index: number) => void;
}

export const useVideoPlayerStore = create<VideoPlayerState>()(set => ({
  bears: 0,
  increase: by => set(state => ({ bears: state.bears + by })),
  VideoPlayerSRc: '',
  setVideoPlayerSrc: (src: string) => set(() => ({ VideoPlayerSRc: src })),
  VideoPlayerIndex: 0,
  setVideoPlayerIndex: (index: number) =>
    set(() => ({ VideoPlayerIndex: index })),
}));
